package com.xj.test.moduledemo

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView
import com.xj.test.module_a_provider.ModuleAService
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collect
import javax.inject.Inject
import androidx.lifecycle.lifecycleScope
import kotlinx.coroutines.launch

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {

    @Inject
    lateinit var moduleAService: ModuleAService


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val tvContent: TextView = findViewById(R.id.tv_content)
        lifecycleScope.launch {
            moduleAService.getModuleABean().collect {
                tvContent.text = it.msg
            }
        }
    }
}